<template>
  <div class>
    <!-- 面包屑 -->
    <breadcrumb>
      <span slot="main">权限管理</span>
      <span slot="main_a">权限列表</span>
    </breadcrumb>
    <!-- 面包屑 -->
    <!-- 卡片 -->
    <el-card class="box-card">
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column prop="authName" label="权限名称"></el-table-column>
        <el-table-column prop="path" label="权限路径"></el-table-column>
        <el-table-column prop="level" label="权限路径">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.level === '0'">一级</el-tag>
            <el-tag v-else-if="scope.row.level === '1'" type="success">二级</el-tag>
            <el-tag v-else type="danger">三级</el-tag>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'MyComponent',
  props: {},
  data() {
    return {
      // 权限列表
      tableData: []
    }
  },
  created() {
    this.gettableData()
  },
  methods: {
    async gettableData() {
      let res = await this.$axios.get('rights/list')
      // console.log(res)
      if (res.data.meta.status !== 200) {
        return this.$message.error('获取权限列表失败！')
      }
      // this.$message.success('获取权限列表成功！')
      this.tableData = res.data.data
    }
  }
}
</script>

<style scoped lang='less'></style>
